package com.hmyd.hmyd_android.ui;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import com.hmyd.hmyd_android.view.listview.IXViewListener;
import com.hmyd.hmyd_android.view.listview.XListView;


public class BasicListActivity extends BasicActivity implements IXViewListener{
protected boolean isLoading = false;
	
	@Override
	public void onRefresh() {
		if(isLoading){
			return;
		}
		isLoading = true;
	}

	@Override
	public void onLoadMore() {
		if(isLoading){
			return;
		}
		isLoading = true;
	}
	
	public XListView getXList(){
		return null;
	}
	
	@Override
	public void onPostSuccess(int postId,String result) {
		isLoading = false;
		
		if(getXList()!=null){
			getXList().stopRefresh();
			getXList().stopLoadMore();
			getXList().setRefreshTime(getTime());
		}
		
	}
	
	@Override
	public void onPostFailure(int postId,String msg) {
		isLoading = false;
		
		if(getXList()!=null){
			getXList().stopRefresh();
			getXList().stopLoadMore();
			getXList().setRefreshTime(getTime());
		}
		
	}
	
	protected String getTime() {
		return new SimpleDateFormat("MM-dd HH:mm", Locale.CHINA)
				.format(new Date());
	}

	@Override
	protected void setParams() {
		
	}

	@Override
	protected void leftButton() {
		
	}

	@Override
	protected void rightButton() {
		
	}
}
